/*
 *  Copyright (C) 2010:
 *                 Buzzanca Marco <marco.bzn@gmail.com>
 *         Monaco Davide Giuseppe <black.ralkass@gmail.com>
 *              Petralia Veronica <veronicapetralia@gmail.com>
 *
 * This file is part of DS2011BMP
 *
 * DS2011BMP is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * DS2011BMP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

/** 
 * @file workflow.cpp
 * @author Davide Giuseppe Monaco
 *
 * This file contains Workflow class implementation.
 */

#include "workflow.h"

Workflow::Workflow(void)
  : _ID(-1) { }

Workflow::Workflow(int id)
  : _ID(id) { }

Workflow::~Workflow(void){}

const std::vector<TaskDescriptor>& Workflow::getTasks(void) const
{
  return _tasks;
}

void Workflow::setTasks(const std::vector<TaskDescriptor>& val)
{
  _tasks = val;
}

const TaskDescriptor& Workflow::getTask(int index) const
{
	return _tasks[index];
}

int Workflow::addTask(const TaskDescriptor& ts)
{
  _tasks.push_back(ts);
  return 0;
}

int Workflow::getID(void) const
{
	return _ID;
}

void Workflow::setID(int val)
{
	_ID = val;
}

size_t Workflow::size(void) const
{
  return _tasks.size();
}

std::ostream& operator << (std::ostream& os, const Workflow& wf)
{
  os << "ID: " << wf._ID << std::endl;

  for (size_t i = 0; i < wf.size(); i++)
    os << "\t" << wf.getTask(i) << std::endl;

  return os;
}
